package ZooManagement;

import java.util.ArrayList;

class Zoo {
    private String name;
    private String location;
    private ArrayList<Animal> animals;
    private ArrayList<Item> items;
    private double ticketPrice;

    public Zoo(String name, String location, double ticketPrice) {
        this.name = name;
        this.location = location;
        this.ticketPrice = ticketPrice;
        this.animals = new ArrayList<>();
        this.items = new ArrayList<>();
    }

    // Methods to manage animals
    public void addAnimal(Animal animal) {
        animals.add(animal);
    }

    public boolean removeAnimal(String animalName) {
        for (Animal animal : animals) {
            if (animal.getName().equals(animalName)) {
                animals.remove(animal);
                return true;
            }
        }
        return false;
    }

    public Animal findAnimal(String animalName) {
        for (Animal animal : animals) {
            if (animal.getName().equals(animalName)) {
                return animal;
            }
        }
        return null;
    }

    // Methods to manage items
    public void addItem(Item item) {
        items.add(item);
    }

    public boolean removeItem(String itemName) {
        for (Item item : items) {
            if (item.getName().equals(itemName)) {
                items.remove(item);
                return true;
            }
        }
        return false;
    }

    public Item findItem(String itemName) {
        for (Item item : items) {
            if (item.getName().equals(itemName)) {
                return item;
            }
        }
        return null;
    }

    // Getters and setters
    public String getName() {
        return name;
    }

    public String getLocation() {
        return location;
    }

    public ArrayList<Animal> getAnimals() {
        return new ArrayList<>(animals); // Return a copy to preserve encapsulation
    }

    public ArrayList<Item> getItems() {
        return new ArrayList<>(items); // Return a copy to preserve encapsulation
    }

    public double getTicketPrice() {
        return ticketPrice;
    }

    public void setTicketPrice(double ticketPrice) {
        this.ticketPrice = ticketPrice;
    }

    @Override
    public String toString() {
        return "Zoo{" +
                "name='" + name + '\'' +
                ", location='" + location + '\'' +
                ", animals=" + animals +
                ", items=" + items +
                ", ticketPrice=" + ticketPrice +
                '}';
    }
}

// Logistics class handling transportation between zoos



